<link rel="stylesheet" type="text/css"
	href="static/js/ext/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="static/css/scribbles.css">
<script language="javascript" src="static/js/ext/bootstrap.js"></script>
<script language="javascript" src="static/js/common/commonObjects.js"></script>
<script language="javascript" src="static/js/model/commonModels.js"></script>

<script type="text/javascript">
	context = new Object();
	context.user = new User();

	function isUserLoggedIn() {
		if(context.user.userId != undefined ) {
			return true;
		} else {
			return false;
		}
	}

	function loadJS(jsfile, callBackMethod) {
		Ext.ux.OnDemandLoad.load(jsfile,callBackMethod);
	}

	Ext.namespace('Ext.ux');

	Ext.ux.OnDemandLoad = function(){
	    
	    loadComponent = function(component,callback){
	        var fileType = component.substring(component.lastIndexOf('.'));
	        var head = document.getElementsByTagName("head")[0];
	        var done = false;
	        if (fileType === ".js") {
	            var fileRef = document.createElement('script');
	            fileRef.setAttribute("type", "text/javascript");
	            fileRef.setAttribute("src", component);
	            fileRef.onload = fileRef.onreadystatechange = function(){
	                    if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") ) {
	                        done = true;
	                        eval(callback+'()');
	                        head.removeChild(fileRef);
	                    }
	                };
	        } else if (fileType === ".css") {
	            var fileRef = document.createElement("link");
	            fileRef.setAttribute("type", "text/css");
	            fileRef.setAttribute("rel", "stylesheet");
	            fileRef.setAttribute("href", component);
	        }
	        if (typeof fileRef != "undefined") {
	            head.appendChild(fileRef);
	        }
	    };

	    return {
	        load: function(components, callback){
	            Ext.each(components, function(component){
	                loadComponent(component,callback);
	            });
	        }
	    };
	}();

</script>